<template>
  <div>
    <van-search
      :show-action="isbools"
      v-model="value"
      placeholder="请输入搜索关键词"
      @search="onSearch"
      @cancel="onCancel"
      v-if="bos"
    />
    <van-search
      v-else
      :show-action="isbools"
      v-model="value"
      placeholder="请输入搜索关键词"
      @search="que"
      @cancel="onCancel"
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: "",
      isbools: false,
      bos: true
    };
  },
  methods: {
    // 搜索
    onSearch(val) {
      this.$toast(val);
      this.isbools = true
      this.Sto.Session.set("search", this.value)
      this.bos = false
      this.$router.push("/search")

    },
    que(val) {
      this.isbools = true
      this.$emit("reds", this.value)
    },
    onCancel() {
      console.log("?");
      this.isbools = false
      this.bos = true
      this.$router.push("/")
    }
  },
};
</script>

<style  scoped>
</style>